#include<stdio.h>

//计算从n到1的每个数的阶乘之和

//1.我自己构思的代码：
/*
int main()
{
	int n = 0;
	int sum = 0;
	
	scanf("%d",&n);
	for(int a = n;a >= 1;a--)
	{
		int ret = 1;
		for(int i = 1;i <= a;i++)
		{
			ret = ret * i;
		}
		sum += ret;
		
	}

	printf("%d\n",sum);
	
	
return 0;	
}
*/

//2.教学视频举例的更简洁高效的代码:
int main()
{
	int ret = 1;
	int sum = 0;
	int n = 0;
	scanf("%d",&n);
	
	for(int i = 1;i <= n;i++)
	{
		ret *= i;
		sum += ret;
	}
	printf("%d\n",sum);
	
return 0;
}

